<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            margin: 100px;
            width: 460px;
        }
        
        .box .btn {
            height: 40px;
            margin-bottom: 5px;
        }
        
        .box .btn input {
            float: left;
            width: 100px;
            text-align: center;
            height: 40px;
            margin-right: 20px;
            border: 1px solid #334455;
        }
        
        .box .btn input:nth-child(4) {
            margin-right: 0px;
        }
        
        .box .col {
            width: 460px;
            height: 400px;
            border: 1px solid #ccc;
            box-sizing: border-box;
            display: none;
        }
        
        .box .btn .dianji {
            background: red;
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="btn">
            <input type="button" class="bba dianji" value="体育">
            <input type="button" class="bba" value="娱乐">
            <input type="button" class="bba" value="新闻">
            <input type="button" class="bba" value="教育">
        </div>
        <div class="col" style="display: block;">体育</div>
        <div class="col">娱乐</div>
        <div class="col">新闻</div>
        <div class="col">教育</div>
    </div>
    <script>
        // 获取元素 标签名
        var btn = document.getElementsByTagName("input");
        // 获取元素 class名
        var col = document.getElementsByClassName("col");
        // 添加点击事件
        for (var i = 0; i < btn.length; i++) {
            btn[i].ccc = i;
            btn[i].onclick = function() {
                for (var j = 0; j < btn.length; j++) {
                    // 去掉点击 保留bba
                    btn[j].className = "bba";
                    // 隐藏
                    col[j].style.display = "none";

                }
                // 点击的时候添加class名
                this.className = "bba dianji";

                col[this.ccc].style.display = "block";

            }
        }
    </script>
</body>

</html>